﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using CommClass;
using DMS.CommClass;


namespace DMS
{
    public partial class FrmViewSurplier : DMS.FrmTemplate    
    {

        Surplier sp = new Surplier(App.Ds);

        public string storageId = "";

        string surplierID = "";
        public FrmViewSurplier(string surplier)     
        {
            InitializeComponent();
     
            //如果传入了入库单id，就查询相应的入库单，并且赋值
            if (surplier != null && surplier != "")
            {
                DataTable dt = sp.getSurplierDataBycheck(" a.[SupplySupplierID]  = " + surplier);
                if (dt.Rows.Count > 0)
                {
                    surplierID = surplier;
                    label3.Text  = dt.Rows[0]["SupplySupplierName"].ToString();
                    label13.Text = dt.Rows[0]["StorageName"].ToString();
                    label14.Text = dt.Rows[0]["shouhuoshuxinmiaoshu"].ToString();
                    label15.Text = dt.Rows[0]["cengjimiaoshu"].ToString();
                    label16.Text = dt.Rows[0]["hezuoshangpin"].ToString();
                    label17.Text = dt.Rows[0]["fukuanmiaoshu"].ToString();
                    label20.Text = dt.Rows[0]["SupplySupplierStatusmiaoshu"].ToString();
                    label22.Text = dt.Rows[0]["dizhi"].ToString();
                    label23.Text = dt.Rows[0]["lianxifangshi"].ToString();
                    label24.Text = dt.Rows[0]["yinhangzhanghao"].ToString();
                    label25.Text = dt.Rows[0]["gonghuofanwei"].ToString();
                    label26.Text = dt.Rows[0]["qisongliang"].ToString();
                    label27.Text = dt.Rows[0]["tiqianqi"].ToString();
                    label28.Text = dt.Rows[0]["zhangqi"].ToString();

                    DataTable dtt = sp.getSurplierproductDataBycheck(" a.[SupplySupplierID]  = " + surplier);
                    if (dtt.Rows.Count > 0)
                    {
                        this.dgvdo.DataSource = dtt;

                    }
                }
            }

        }


 


        

        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) 
        {

          
        }

        private void dataGridView1_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            //查看提单明细信息
           // int row = dgvdo.Rows[e.RowIndex].Index;
           // sedonumber = dgvdo.Rows[row].Cells[1].Value.ToString();//当前选定的提货单号
          //  FrmDoEntry form = new FrmDoEntry();
          //  form.ReDoNumber = sedonumber;
           // form.ShowDialog();
        }

      





      

        private void button1_Click(object sender, EventArgs e)
        {
            this.Close();
        }



        private void label3_Click(object sender, EventArgs e)
        {

        }

       
       // private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e)
     //   {

      //  }

    }
}
